const { Sequelize, sequelize } = require('./sequelize');

const ExperimentPlan = sequelize.define('ExperimentPlan', {
  ecId: {
    type: Sequelize.INTEGER,
    allowNull: false,
    unique: 'primaryKey',
    // references: {
    //   model: ExperimentCourse,
    //   key: 'ecId',
    // },
  },
  epBatch: {
    type: Sequelize.INTEGER,
    allowNull: false,
    unique: 'primaryKey',
  },
  tIds: {
    type: Sequelize.STRING,
    allowNull: false,
  },
  epTime: {
    type: Sequelize.INTEGER,
    allowNull: false,
    // get() {
    //   const epTime = this.getDataValue('epTime');
    //   const weekOfSemester = Math.floor(epTime / 100);
    //   const week = Math.floor(epTime / 10 % 10);
    //   const period = epTime % 10;
    //   const PERIOD = ['', '上午', '下午', '晚上'];
    //   return `第${weekOfSemester}周周${week}${PERIOD[period]}`;
    // },
  },
  lId: {
    type: Sequelize.INTEGER,
    allowNull: false,
    // references: {
    //   model: Laboratory,
    //   key: 'lId',
    // },
  },
  epStudentNumber: {
    type: Sequelize.INTEGER,
    allowNull: false,
  },
  epIsArranged: {
    type: Sequelize.STRING,
  },
}, {
  modelName: 'ExperimentPlan',
  tableName: 'experiment_plan',
  timestamps: false,
});

module.exports = {
  ExperimentPlan
};
